{template 'header'}
<ul class="nav nav-tabs">
    <li class=""><a href="{php echo $this->createWeburl('program');}">小程序管理</a></li>
    <li class="active"><a href="{php echo $this->createWeburl('program', array('op' => 'addShow'));}">添加小程序</a></li>
</ul>
<form action="" method="post" class="form-horizontal" id="myform" role="form" enctype="multipart/form-data">
    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">图标:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            {php echo tpl_form_field_image('icon', $program['icon'], tomedia($program['icon']));}
            <span style="color: red">50  * 50</span>
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">名称:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            <input class="form-control" name="name" placeholder="名称" value="{$program['name']}" type="text">
        </div>
    </div>

    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">类型</label>
        <div class="col-sm-9 col-xs-12">
            <label class="radio-inline">
                <input type="radio" name="type" value="1" {if $program['type'] ==1 || $program['type'] == ''} checked {/if} /> 小程序
            </label>
            <label class="radio-inline">
                <input type="radio" name="type" value="2" {if $program['type'] ==2} checked {/if} />H5
            </label>
        </div>
    </div>

    <div class="form-group" id="appId" {if $program['type'] ==2} style="display: none" {/if}>
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">appId:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            <input class="form-control" name="appid" placeholder="appId" value="{$program['appid']}" type="text">
        </div>
    </div>
    <div class="form-group" >
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">路径:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            <input class="form-control" name="path" placeholder="路径" value="{$program['path']}" type="text">
         <!--   <span style="color:red;">例如: /bh_step/pages/index/index 注意,路径开始得有 / </span>-->
        </div>
    </div>

    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">位置</label>
        <div class="col-sm-9 col-xs-12">
            <label class="radio-inline">
                <input type="radio" name="position" value="1" {if $program['position'] ==1 || $program['type'] == ''} checked {/if} /> 更多小程序
            </label>
            <label class="radio-inline">
                <input type="radio" name="position" value="2" {if $program['position'] ==2} checked {/if} />首页
            </label>
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">序号:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            <input class="form-control" name="sort" placeholder="序号" value="{$program['sort']}" type="text">
            <span style="color: red"> 请填写阿拉伯数字 数字越大越在前面</span>
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label"></label>
        <div class="" >
            <input type="hidden" name="op" value="{php echo $id ? 'edit' : 'add'}">
            <input type="hidden" name="id" value="{$id}">
            <input type="submit" name="submit" id="submit" value="{php echo $id ? '修改' : '新增'}" class="btn btn-primary">
        </div>
    </div>
</form>
{template 'footer'}

<script>
    $(function () {
        $("input[name='type']").click(function () {
            if ( $(this).val() ==1 ) {
                $('#appId').show();
            } else {
                $('#appId').hide();
            }
        });
    })


</script>